<?php

include_once("model/Model.php");
include_once("model/Connection.php");

class Controller {
    public $model;

    public function __construct() {
        $this->model = new Model();
    }

    public function invoke() {
        $page = isset($_GET['page']) ? $_GET['page'] : 1;
        $armin = isset($_GET['armin']) ? $_GET['armin'] : '';
        $armax = isset($_GET['armax']) ? $_GET['armax'] : '';
        $marka = isset($_GET['marka']) ? $_GET['marka'] : '';
        $kepatlo = isset($_GET['kepatlo']) ? $_GET['kepatlo'] : '';
        $leiras = isset($_GET['leiras']) ? $_GET['leiras'] : '';

        list($monitors,$pages) = $this->model->getMonitorsList($page,$armin,$armax,$marka,$kepatlo,$leiras,Connection::getConnection());
        include 'view/monitorlist.php';
    }
}
